import type { ListResponse } from '@/types/common'
import type {
  AllBuildingItemRes,
  AllEnterpriseItemRes,
  PropertyFeeAddParams,
  PropertyFeeDetailRes,
  PropertyFeeItemRes,
  PropertyFeeListParams
} from '@/types/propertyfee'
import { request } from '@/utils/reuqest'

/**
 * 获取物业费列表
 */
export const getPropertyFeeListAPI = (params: PropertyFeeListParams) => {
  return request<ListResponse<PropertyFeeItemRes>>(
    '/park/propertyfee',
    'GET',
    params
  )
}

/**
 * 获取物业费详情 /park/propertyfee/{id}
 */
export const getPropertyFeeDetailAPI = (id: number) => {
  return request<PropertyFeeDetailRes>('/park/propertyfee/' + id, 'GET')
}

/**
 * 物业费-删除账单信息 /park/propertyfee/{id}
 */
export const deletePropertyFeeAPI = (id: number) => {
  return request(`/park/propertyfee/${id}`, 'DELETE')
}

/**
 * 物业费-添加账单 /park/propertyfee
 */
export const addPropertyFeeAPI = (params: PropertyFeeAddParams) => {
  return request('/park/propertyfee', 'POST', params)
}

/**
 * 查询所有楼宇
 */
export const getAllBuildingListAPI = () => {
  return request<AllBuildingItemRes[]>('/park/all/building', 'GET')
}

/**
 * 查询所有企业
 */
export const getAllEnterpriseListAPI = () => {
  return request<AllEnterpriseItemRes[]>('/park/all/enterprise', 'GET')
}